package basic

import (
	"context"
	"io"

	. "gitee.com/liukexing/isrn/api"
)

type CatCommand struct {
	Shell
}

func (s *CatCommand) Cat(path string) (io.ReadCloser, error) {
	resp, err := s.Request("cat", path).Send(context.Background())
	if err != nil {
		return nil, err
	}
	if resp.Error != nil {
		return nil, resp.Error
	}
	return resp.Output, nil
}
